import ajax from "@/utils/request";

export function comdataFn() {
    return ajax({
        url: '/api/community',
        method: 'post',
    })
}

interface iAddcom {
    id: string,
    time: string,
    title: string,
    img1: string,
    img2: string,
    img3: string,
    share: number,
    chat: number,
    photo: string,
    index?:number,
}

export function addcomdataFn(data: iAddcom) {
    return ajax({
        url: '/api/addcommunity',
        method: 'post',
        data
    })
}



export function deletcommunityFn(data: number) {
    return ajax({
        url: '/api/deletcommunity',
        method: 'post',
        data
    })
}


export function modcommunityFn(data: number) {
    // console.log('ajax', data);

    return ajax({
        url: '/api/modcommunity',
        method: 'post',
        data: String(data)
    })
}

export function changecommunityFn(data: iAddcom) {
    console.log('ajax', data);

    return ajax({
        url: '/api/changecommunity',
        method: 'post',
        data: data
    })
}


// 收藏
export function collectionFn(data: any) {
    console.log('ajax', data);

    return ajax({
        url: '/api/collection',
        method: 'post',
        data: data
    })
}

